<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{:config('web_title')} - {:config('soft.name').config('soft.version')}</title>
</head>
<link rel="shortcut icon" href="__STATIC__favicon.ico" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__ExtJS/classic/theme-triton/resources/theme-triton-all.css" />
<link rel="stylesheet" type="text/css" href="__STATIC__admin/css/login.css" />
<script type ="text/javascript" src="__SITE__admin/publics/config"></script>
<script type ="text/javascript" src="__PUBLIC__ExtJS/ext-all.js"></script>
<script type ="text/javascript" src="__PUBLIC__ExtJS/locale/locale-zh_CN.js"></script>
<script type ="text/javascript" src="__PUBLIC__ExtJS/classic/theme-triton/theme-triton.js"></script>
<script>
    Ext.onReady(function () {
        var _Box = Ext.create('Ext.panel.Panel', {
            id:'Main_Box',
            bodyStyle:'background:none',
            tbar:Ext.create('Ext.toolbar.Toolbar', {
                cls:'tools',
                defaults:{
                    cls:'tools_cont'
                },
                items:[
                    {xtype:'image',src: _WEB['logo'],width:120,height: 30},
                    '->',
                    {text:'官网',handler: function(){
						window.open("{:config('soft.site')}")
                    }},
                    {text:'论坛',handler: function(){
						window.open("{:config('soft.bbs')}")
                    }},
                    {text:'手册',handler: function(){
						window.open("{:config('soft.doc')}")
                    }},
                    {text:'技术支持',handler: function(){
						window.open("http://wpa.qq.com/msgrd?v=3&uin={:config('soft.qq')}&site=qq&menu=yes")
                    }},
                ]
            }),
            bbar:Ext.create('Ext.toolbar.Toolbar', {
                cls:'tools',
                defaults:{
                    cls:'tools_cont'
                },
                items:[
                    {xtype:'label',html:' Copyright © {:config("soft.copyright")} {:config("soft.name")}<sup>{:config("soft.version")}</sup>',style:'color:#ccc'},
                    '->',
                    {text:'联系管理员',handler: function(){
						window.open("http://wpa.qq.com/msgrd?v=3&uin={:config('admin_qq')}&site=qq&menu=yes")
                    }},
                ]
            }),
        });
        var _Win = Ext.create('Ext.window.Window', {
            header: false,
            style:'border-color:#fff',
            width: 500,
            layout:'fit',
			resizable:false,
            tbar:Ext.create('Ext.toolbar.Toolbar', {
                style:'padding:0',
                items:[
                    {xtype:'image',src: '__STATIC__/admin/img/login/login_box.jpg',width:500,height: 250},
                ]
            }),
            items: {  // Let's put an empty grid in just to illustrate fit layout
                xtype: 'tabpanel',
                border: false,
                items:[
                    {
                        id:'login_form',
                        title:'登陆',
                        xtype:'form',
                        bodyStyle:'padding:20px 50px;',
                        defaults:{
                            xtype:'textfield',
                            labelWidth:80,
                            labelAlign:'right',
                        },
                        items:[
                            {id: "account",name: "account",fieldLabel :'账户',emptyText: '用户名/手机/邮箱',anchor:'100%',height: 28},
                            {id: "password",name: "password",inputType: 'password',fieldLabel :'密码',emptyText: '请输入密码',anchor:'100%',height: 28},
                            {id: "code",name: "code",fieldLabel :'验证码',emptyText: '点击图片刷新验证码',maxLength:4,minLength:4,anchor:'60%',height: 28},
                            {id: "code_image",xtype:'image',src: _PATH['site']+'/admin/publics/verify',width:150,height: 50,style:'margin-left:85px; border:1px solid #CCC;',listeners:{
                                //监听click事件
                                el:{
                                    click:function(){
                                        Ext.getCmp('code_image').setSrc(_PATH['site']+'/admin/publics/verify?t='+Date.parse(new Date()));
                                    }
                                }
                            }},
                        ],
                        bbar:Ext.create('Ext.toolbar.Toolbar', {
                            style:'background:#5fa2dd',
                            items:[
                                '->',
                                {
                                    text:'提交',
                                    handler:function(){
                                        Ext.Ajax.request({
                                            url: _PATH['site']+'/admin/publics/login',
                                            params: Ext.getCmp('login_form').getValues(),
                                            method: 'POST',
                                            success: function (response, options) {
                                                var _Res = JSON.parse(response.responseText); 
                                                if(_Res.code.toString() == '200'){
                                                    Ext.MessageBox.alert('成功', _Res.msg);
                                                    window.location.href=_Res.data;
                                                }else{
                                                    Ext.getCmp('code_image').setSrc(_PATH['site']+'/admin/publics/verify?t='+Date.parse(new Date()));
                                                    Ext.getCmp('code').setValue('');
                                                    Ext.MessageBox.alert('失败 错误代码：'+_Res.code, _Res.msg);
                                                }
                                                //Ext.MessageBox.alert('成功', response.responseText);
                                            },
                                            failure: function (response, options) {
                                                Ext.MessageBox.alert('失败', '请求超时或网络故障');
                                            }
                                        });	
                                    }
                                },
                            ]
                        }),
                        
                    },
                ]
            }
        }).show();
        Ext.create('Ext.container.Viewport', {
            layout: 'fit',
            items: [
                _Box
            ]
        });
    })
</script>
<body style="background:url(__STATIC__/admin/img/login/bg.jpg) center">
</body>
</html>
